﻿using System;
using UnityEngine;

// Token: 0x02000027 RID: 39
public class Sound : MonoBehaviour
{
	// Token: 0x060000B0 RID: 176 RVA: 0x0000FC08 File Offset: 0x0000DE08
	public static void Play(AudioClip clip, Vector2 pos, bool twoDimensional = false, bool pitch = true, float vol = 1f)
	{
		if (clip != null)
		{
			GameObject gameObject = new GameObject("Quick Audio", new Type[]
			{
				typeof(AudioSource)
			});
			AudioSource component = gameObject.GetComponent<AudioSource>();
			gameObject.transform.position = pos;
			float num = 1f;
			if (pitch)
			{
				Random.Range(0.75f, 1.25f);
			}
			component.pitch = num;
			if (twoDimensional)
			{
				component.spatialBlend = 0f;
			}
			else
			{
				component.spatialBlend = 1f;
			}
			component.volume = vol;
			component.PlayOneShot(clip);
			Object.Destroy(gameObject, clip.length / num);
		}
	}
}
